package com.wzxy.parse.service;

import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wzxy.parse.tbw.TbwOriginArticle;
import com.wzxy.spider.tbw.entity.TbwNews;
import com.wzxy.spider.tbw.service.impl.TbwService;

@Service
public class TbwParseService {

	@Autowired
	private TbwService tbwService;
	@Autowired
	private TbwOriginArticle tbwOriginArticle;
	
	public void start(){
		List<TbwNews> list = tbwService.findAll();
		for (int i = 0; i < list.size(); i++) {
			
			if (!"DONE".equals(list.get(i).getStatus())) {
				try {
					tbwOriginArticle.startParse(list.get(i));
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
	
}
